﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Markup;
using HtmlAgilityPack;

namespace Reading.Htmlhelper
{
    public class Element
    {
        private const string RichTextBoxTemplate = @"
        <RichTextBox  xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation"">
            {0}
        </RichTextBox>";

        public string Convert(string html)
        {
            HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
            doc.LoadHtml(HttpUtility.HtmlDecode(html));



            return string.Format(RichTextBoxTemplate);
        }

        public RichTextBox ConvertToRichTextBox(string html)
        {
            RichTextBox box = XamlReader.Load(Convert(html)) as RichTextBox;
            return box;
        }
    }
}
